# 阶段一：构建Vitepress应用
FROM node:18 as builder
WORKDIR /app
COPY package.json package-lock.json /app/
RUN npm install --registry=https://registry.npmmirror.com
COPY . /app
RUN npm run build

# 阶段二：构建Nginx映像并复制Vitepress构建结果
# FROM nginx:1.21.6
FROM lishaohai/nginx-brotli:1.25.4

# 覆盖容器的default.conf和nginx.conf
COPY ./default.conf /etc/nginx/conf.d/default.conf
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
